<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>农污处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/huazhi/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/huazhi/style/admin.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/huazhi/style/template.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/huazhi/layui/css/extension/Import/import.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/huazhi/layui/css/extension/importcheck/iconfont.css">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/jsp/hz/favicon.ico" />

    <style>
        .divhtml{
            line-height: 20px;
            padding: 9px 0px;
            text-align:left;
            position:relative;
            display:block;
            float:left;
            font-weight: 400;
        }
        .imports{
            border: 1px solid #ccc;
            color: #333;
            cursor: pointer;
            height: 26px;
            line-height: 16px;
            margin-right: 10px;
            padding: 5px;
            position: relative;
            text-align: center;
            transition: all 0.5s ease 0s;
            width: 26px;
        }


    </style>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <blockquote class="layui-elem-quote">
                <div class="layui-inline">
                    <div class="layui-input-inline" >
                        <input class="layui-input searchval"  type="text" placeholder="请输入搜索的内容">
                    </div>
                    <button class="layui-btn" id="search_btn" data-type="reload">搜索</button>
                </div>

            </blockquote>
            <table class="layui-hide" id="noInitialList" lay-filter="noInitialLists"></table>
            <div id="laypage"></div>
        </div>
    </div>
    <script type="text/html" id="table-noInitial">
        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="info">详情</a>
    </script>

    <script type="text/html" id="aaaaaTable">
        <div class="layui-inline" lay-event="add" title="添加">
            <i class="layui-icon layui-icon-add-1"></i>
        </div>
    </script>
</div>

<input type="hidden" id="successes"/>
<%--从excel导入的数据--%>
<input type="hidden" id="datas"/>
<%--从验证的错误数据--%>
<input type="hidden" id="correctlenght"/>

<input type="hidden" id="correctdata"/>

<input type="hidden" id="correctsuccesses"/>

<script src="<%=request.getContextPath()%>/jsp/huazhi/layui/layui.js"></script>
<script src="<%=request.getContextPath()%>/jsp/huazhi/layui/jquery-min.js"></script>
<script src="<%=request.getContextPath()%>/jsp/huazhi/layui/lay/modules/upload.js"></script>
<script>
    layui.config({
        base: '<%=request.getContextPath()%>/jsp/huazhi/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','noInitialList','upload','table'], function() {
        var $ = layui.$
            , table = layui.table
            , layer = layui.layer
            ,upload = layui.upload;

        //搜索事件
        var  active = {
            reload: function(){
                var searchval = $('.searchval').val();
                table.reload('noInitialList', { //表格的id
                    where: {
                        key: searchval
                    },
                    text: {
                        none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                    }
                })
            }
        };
        $('#search_btn').on('click', function(){ //搜索的id
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        //监听头工具栏事件
        table.on('toolbar(noInitialLists)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id)
                ,data = checkStatus.data;//获取选中的数据
            switch(obj.event){
                case 'add':

                    add();
                    break;
                case 'update':
                    update(data);
                    break;
                case 'delete':
                    deletes(data);
                    break;
                case 'batchadd':
                    batchadd();
                    break
            };
        });

        function add(){
            var clocess="1";
           layer.open({
                title : "添加信息",
                type: 2,
                content: '<%=request.getContextPath()%>/rest/method/pathMethod?type=noInitial&url=noInitialAdd',
                area: ['90%', '91%'],
                maxmin: true,
                shade:0.8,
                anim: 4,
                skin: 'layui-layer-molv',
                resize:true,
                cancel: function(index, layero) {
                    layer.close(index)
                    clocess="2"
                    return false;
                },
                end: function () {
                    if(clocess=="2"){

                    }else {
                        table.reload('noInitialList')
                    }
                    return false;
                }

            });
            $('.layui-layer-setwin .layui-layer-min').css("display","none")
            $('.layui-layer-setwin .layui-layer-max').css("display","none")
//            setTimeout(function(){
//                layui.layer.tips('点击此处返回物资列表', '.layui-layer-setwin .layui-layer-close', {
//                    tips: 3
//                });
//            },500)
//            layer.full(index);
//            window.sessionStorage.setItem("index",index);
//            //改变窗口大小时，重置弹窗的宽高，防止超出可视区域（如F12调出debug的操作）
//            $(window).on("resize",function(){
//                layer.full(window.sessionStorage.getItem("index"));
//            })
        }


    });


</script>
</body>
</html>